<template>
  <div style="border: 1px solid black; padding: 20px; margin-top: 20px">
    <div>子组件</div>
    输入数据：{{ modelValue }}
    <div><button @click="clear">清空父组件数据</button></div>
  </div>
</template>
<script setup lang="ts">
defineProps(['modelValue'])

const $emit = defineEmits(['update:modelValue'])

const clear = () => {
  const resetValue = ''
  $emit('update:modelValue', resetValue as string)
}
</script>

<style scoped></style>
